#Using the higher order function reduce(), write a function max_in_list()
#that takes a list of numbers and returns the largest one. Then ask yourself: why define and call a new function,
#when I can just as well call the reduce() function directly?

liczby = [2,1,-4,4,5]

def max_in_list(liczby):

    def suma(x,y):
    
        if x > y:
            return x
        else:
            return y
    
    return reduce(suma, liczby)

print max_in_list(liczby)
